package multiThread;


public class Priority_Demo {
	private static Thread HighPriority_thread;
	private static Thread LowPriority_thread;

	public static void main(String[] args) {
		HighPriority_thread = new Thread(new Runnable() {
			
			@Override
			public void run() {
				int i = 0;
				while(true){
					System.out.println("Hello High");
					while(++i == 20)
						break;
				}
			}
		});
		
		LowPriority_thread = new Thread( new Runnable() {
			
			@Override
			public void run() {
				int i = 0;
				while(true){
					System.out.println("Hellp Low");
//					try {
//						Thread.sleep(1000);
//					} catch (InterruptedException e) {
//						// TODO Auto-generated catch block
//						e.printStackTrace();
//					}
					
					if(++i == 20)
						break;
				}
			}
		});
		
		
		
		LowPriority_thread.setPriority(Thread.MIN_PRIORITY);
		HighPriority_thread.setPriority(Thread.MAX_PRIORITY);
		
		LowPriority_thread.start();
		HighPriority_thread.start();
	}

}
